package com.nercel.dsj.gksales.service.impl;

import com.nercel.dsj.gksales.dao.mapper.RegionMapper;
import com.nercel.dsj.gksales.model.QueryParams;
import com.nercel.dsj.gksales.model.dto.RegionBasicResultDTO;
import com.nercel.dsj.gksales.model.entity.Region;
import com.nercel.dsj.gksales.service.RegionService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author sunlin
 * @date 2019-4-12
 */
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class RegionServiceImpl implements RegionService {

	private final RegionMapper regionMapper;

    @Override
    public void save(Region region) {
        regionMapper.insertSelective(region);
    }

    @Override
    public void update(Region region) {
        regionMapper.updateByPrimaryKeySelective(region);
    }

    @Override
    public Region findById(Integer integer) {
        return regionMapper.selectByPrimaryKey(integer);
    }

    @Override
    public List<Region> listAll() {
        return null;
    }

    @Override
    public void delete(Integer integer) {
        regionMapper.deleteByPrimaryKey(integer);
    }

    @Override
    public List<Region> query(QueryParams queryParams) {
        return regionMapper.query(queryParams);
    }

    @Override
    public List<RegionBasicResultDTO> queryWithSimpleInfo(QueryParams queryParams) {
        return regionMapper.queryWithSimpleInfo(queryParams);
    }

}
